import request from '@/utils/request'
/**
 * get-articles
 * @param {current,pageSize,sorter} params
 */
export const getArticles = (params) => {
  return request({
    method: 'GET',
    url: '/interview/query',
    params
  })
}
/**
 * get-article-detail
 * @param {id} params
 */
export const getArticleDetail = (id) => {
  return request({
    method: 'GET',
    url: 'interview/show',
    params: { id }
  })
}
/**
 * update-collect
 * @param {id,optType} params
 */
export const updateCollect = (id) => {
  return request({
    method: 'POST',
    url: 'interview/opt',
    data: { id, optType: 1 }
  })
}
/**
 * update-like
 * @param {id,optType} params
 */
export const updateLike = (id) => {
  return request({
    method: 'POST',
    url: 'interview/opt',
    data: { id, optType: 2 }
  })
}
// 获取我的收藏
export const getArticlesCollect = (obj) => {
  return request.get('/interview/opt/list', {
    params: {
      page: obj.page, // 当前页
      pageSize: 10, // 可选
      optType: 2 // 表示收藏
    }
  })
}

// 获取我的喜欢
export const getArticlesLike = (obj) => {
  return request.get('/interview/opt/list', {
    params: {
      page: obj.page, // 当前页
      pageSize: 10, // 可选
      optType: 1 // 表示喜欢
    }
  })
}
